package com.lvyq.qrobot.server.local;

import com.lvyq.qrobot.common.UrlConstant;
import com.lvyq.qrobot.locadata.OrderCode;
import com.lvyq.qrobot.model.receive.ReceiveMsg;
import com.lvyq.qrobot.model.send.SendParam;
import com.lvyq.qrobot.server.BianMinServer;
import com.lvyq.qrobot.service.UserService;
import com.lvyq.qrobot.util.HttpClientUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author lvyq
 * @version 1.0
 * Create by 2024-05-31 13:50
 */
@Component
public class LocalServer {

    public static UserService userService;

    @Autowired
    public  void setUserService(UserService userService) {
        LocalServer.userService = userService;
    }

    public static void sendMsg(SendParam param, ReceiveMsg vo) {
        //讲笑话
        if (OrderCode.TELL_JOKES.name.equals(vo.message.trim())){
            BianMinServer.tellJokes(param,vo);
            return;
        }
        //点歌
        if (OrderCode.SING_A_SONG.name.equals(vo.message.trim())){
            BianMinServer.singASong(param,vo);
            return;
        }
        if (vo.message.startsWith("点歌")){
            BianMinServer.qqSong(param,vo);
            return;
        }

        //历史今天
        if (OrderCode.HISTORY_TODAY.name.equals(vo.message.trim())){
            BianMinServer.historyToday(param,vo);
            return;
        }
        //热量
        if (vo.message.trim().endsWith("热量")){
            BianMinServer.foodHead(param,vo);
            return;
        }
        //日历
        if (OrderCode.CALENDAR.name.equals(vo.message.trim())){
            BianMinServer.calendar(param,vo);
        }
        //运势
        if (vo.message.trim().endsWith("运势")){
            BianMinServer.horoscope(param,vo);
        }

        if (vo.message.startsWith("[CQ:at,qq=1482996173]")){
            BianMinServer.chat(param,vo);
        }

        //懒大王
        if (OrderCode.LDW.name.equals(vo.message.trim())){
            BianMinServer.ldw(param,vo);
        }

        if (OrderCode.MENU.name.equals(vo.message.trim())){
            param.setMessage(OrderCode.MENU.content);
            HttpClientUtil.doPostJson(UrlConstant.send_group_msg,param);
        }

        if (OrderCode.TGRJ.name.equals(vo.message.trim())){
            BianMinServer.tgrj(param,vo);
        }

        if (OrderCode.SHF.name.equals(vo.message.trim())){
            BianMinServer.shf(param,vo);
        }

        if (OrderCode.GGS.name.equals(vo.message.trim())){
            BianMinServer.ggs(param,vo);
        }
    }
}
